package diqizhou;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main2 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Queue<Integer> A = new LinkedList<Integer>();
		Queue<Integer> B = new LinkedList<Integer>();
		int  N= sc.nextInt();
		for (int i = 0; i < N; i++) {
			int n= sc.nextInt();
			if (n%2==0) 
				B.add(n);
			else A.add(n);
		}
		while(!A.isEmpty() || !B.isEmpty())
		{
			Integer a1 = A.poll();
			if(a1 != null){
				if(B.isEmpty() && A.isEmpty()) System.out.print(a1);
				else System.out.print(a1 + " ");	
			}
			
			Integer a2 = A.poll();
			if(a2 != null){
				if(B.isEmpty() && A.isEmpty()) System.out.print(a2);
				else System.out.print(a2 + " ");	
			}
			Integer b = B.poll();
			if(b != null){
				if(B.isEmpty() && A.isEmpty()) System.out.print(b);
				else System.out.print(b + " ");
			}
			
		}
		sc.close();
	}

}
